<?php

namespace App\Http\Controllers;

use App\Http\Model\Hint;
use App\Http\Model\OutJson;
use App\Http\Services\FullScreenServices;
use Illuminate\Http\Request;

class FullScreenController  extends BaseController
{

    protected $services;

    public function __construct(FullScreenServices $FullScreenServices)
    {
        $this->services = $FullScreenServices;
    }

    public function add(Request $request){
        $input = $request -> input();
        $res = $this->services -> add($input);
        if ($res && $res['code']==Hint::SUCCESS){
            OutJson::outJsonResult(Hint::SUCCESS);
        }
        OutJson::outJsonCustom($res['code'], $res['msg']);
    }
    public function edit(Request $request){
        $input = $request -> input();
        $res = $this->services -> edit($input);

        if ($res && $res['code']==Hint::SUCCESS){
            OutJson::outJsonResult(Hint::SUCCESS);
        }
        OutJson::outJsonCustom($res['code'], $res['msg']);
    }
    public function del(Request $request){
        $input = $request -> input();
        $res = $this->services -> del($input);

        if ($res && $res['code']==Hint::SUCCESS){
            OutJson::outJsonResult(Hint::SUCCESS);
        }
        OutJson::outJsonCustom($res['code'], $res['msg']);
    }

    public function fullList(Request $request){
        $res = $this->services -> fullList();

        OutJson::outJsonResult(Hint::SUCCESS, $res['data']);

    }

    public function getFullPage(Request $request){
        $res = $this->services -> getFullPage();

        OutJson::outJsonResult(Hint::SUCCESS, $res['data']);

    }

    public function getFullScreen(Request $request){
        $id = $request -> input('id', 0);
        $res = $this->services -> getFullScreen($id);

        OutJson::outJsonResult(Hint::SUCCESS, $res['data']);
    }

}
